gusucode.com > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM源码程序 > 支持向量机工具箱 - LIBSVM OSU_SVM LS_SVM\stprtool\generalp\ppoints.m

    function ppoints(X,I,msize,emode,col)
% PPOINTS plots points and their labels.
%   ppoints(X,I,msize,emode) 
%
% PPOINTS plots point sets stored in the matrix X, the 
%  point markers and their color is specified by the vector I.
%  If you want to define pixel size then use argument msize
%  (default value is 5). Argument emode determines
%  the erase mode property (default is 'none').
%
% Input:
%   X [NxK] - K points with dimension N.
%   I [1xK] - Class labels (integers) for each point.
%   msize [1x1] - Point size in pixels, integer.
%   emode - Erase mode, see help UITOOLS.
%
% Example:
%
% Logical function AND
%   X=[0 1 0 1;
%      0 0 1 1];
%   I=[1 1 1 2];   % labels
%
%   ppoints(X,I);
%

% Statistical Pattern Recognition Toolbox, Vojtech Franc, Vaclav Hlavac
% (c) Czech Technical University Prague, http://cmp.felk.cvut.cz
% Written Vojtech Franc (diploma thesis) 23.12.1999, 5.4.2000
% Modifications
% 16-april-2001, V. Franc
% 24. 6.00 V. Hlavac, comments polished.

DIM=size(X,1);
K=size(X,2);

if nargin < 2 | isempty(I),
  I=ones(1,size(X,2));
end

% sets default marker size
if nargin < 3 | isempty(msize),
   msize=5;
end

% sets default 'EraseMode'
if nargin < 4 | isempty(emode),
   emode='none';
end

if nargin < 5,

  % plot points
  for i=1:K,
     % plots the point colored according to the class number
      line(X(1,i),X(2,i),'Color',color(I(i)),...
        'LineStyle','none',...
        'Marker',marker(I(i)),...
        'EraseMode',emode,...
        'MarkerSize',msize);
  end
  
else
  for i=1:K,
     % plots the point colored according to the class number
      line(X(1,i),X(2,i),'Color',col,...
       'LineStyle','none',...
       'Marker',marker(I(i)),...
       'EraseMode',emode,...
       'MarkerSize',msize);
  end
end  

return

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%function []=pplot(X,I,msize,emode)
% PPLOT plots points given in the matrix X
%
%
%DIM=size(X,1);
%K=size(X,2);
%
%% determines what marker to use and its size
%if nargin < 3
%   if K < 50,
%      msize=3;
%      marker='*';
%   else
%      msize=2;
%      marker='*';
%   end
%elseif msize > 5,
%   marker='.';
%else
%   marker='*';
%end
%
%if nargin < 4,
%   emode='none';
%end
%
%% plot points
%for i=1:K,
%   % plots the point colored according to the class number
%    line(X(1,i),X(2,i),'Color',color(I(i)),...
%      'LineStyle','none',...
%      'Marker',marker,...
%      'EraseMode',emode,...
%      'MarkerSize',msize);
%end